#!/bin/bash
#
# Makefile for building cutils module for Python under Linux
# for 64 bits
#

# -fPIC flag enables the compilers to create position independent code
# needed for shared libraries on 64 bit Intel processors

# Check for Python version

PYTHON_VER=$(python -c "import sys; print(sys.version[:3])")
PY_INCLUDE=/usr/include/python$PYTHON_VER
PY_NP=/usr/include/numpy/
NP_INCLUDE=/usr/include/python$PYTHON_VER/numpy/


# LINK & COMPILE
echo compiling ...
echo gcc -c cutils.c -fPIC -I $PY_INCLUDE -I $PY_NP -I $NP_INCLUDE
gcc -c cutils.c -fPIC -I $PY_INCLUDE -I $PY_NP -I $NP_INCLUDE
echo linking ...
echo gcc -shared cutils.o -o _cutils.so
gcc -shared cutils.o -o _cutils.so


